/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityBeans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
//import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

//////////////////////////////////////////////////////////////
//
//		I NEED TO THINK ABOUT THIS TABLE A LITTLE BIT
//		for notifications we will check for receiver part
//		the database design to send request	
//
//////////////////////////////////////////////////////////////
/**
 *
 * @author user
 */
@Entity
@Table(name = "request_notification")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RequestNotification.findAll", query = "SELECT r FROM RequestNotification r"),
    @NamedQuery(name = "RequestNotification.findByNId", query = "SELECT r FROM RequestNotification r WHERE r.nId = :nId"),
    @NamedQuery(name = "RequestNotification.findByType", query = "SELECT r FROM RequestNotification r WHERE r.type = :type"),
    @NamedQuery(name = "RequestNotification.findByReceiver", query = "SELECT r FROM RequestNotification r WHERE r.receiver = :receiver"),
    @NamedQuery(name = "RequestNotification.findByCheck", query = "SELECT r FROM RequestNotification r WHERE r.check = :check")})
public class RequestNotification implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "N_ID")
    private String nId;
//    @Size(max = 20)
    @Column (name="AbilityID")
    private String abilityID;
   
	@Column(name = "Type")
    private String type;
//    @Size(max = 20)
    @Column(name = "Receiver")
    private String receiver;// change the data-type of receiver
    ///////////////////////////////////////////////////////////
    /////  I gave all the papers which you wrote something about the Project .But, I remember what you said to me . 
    /////  "check" will have two values as "t" or "f" . when the value is "t" , it means that checked , and the opposite is unchecked .
    //////////////////////////////////////
    
    @Column(name = "Check")
    private boolean check;
    @Column(name = "Accepted")
    private boolean accepted;

	@JoinTable(name = "send_get", joinColumns = {
    	@JoinColumn(name = "N_ID", referencedColumnName = "N_ID")}, inverseJoinColumns = {
        @JoinColumn(name = "User_ID", referencedColumnName = "User_ID")})
    @ManyToOne
    private User user;

    public RequestNotification() {
    }

    public RequestNotification(String nId) {
        this.nId = nId;
    }

    public String getNId() {
        return nId;
    }

    public void setNId(String nId) {
        this.nId = nId;
    }

    public String getAbilityID() {
		return abilityID;
	}

	public void setAbilityID(String abilityID) {
		this.abilityID = abilityID;
	}
    
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String string) {
        this.receiver = string;
    }

    public Boolean getCheck() {
        return check;
    }

    public void setCheck(Boolean check) {
        this.check = check;
    }

    @XmlTransient
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
    
    public boolean isAccepted() {
		return accepted;
	}

	public void setAccepted(boolean accepted) {
		this.accepted = accepted;
	}

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nId != null ? nId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RequestNotification)) {
            return false;
        }
        RequestNotification other = (RequestNotification) object;
        if ((this.nId == null && other.nId != null) || (this.nId != null && !this.nId.equals(other.nId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "swimtwo.entityBeans.RequestNotification[ nId=" + nId + " ]";
    }
    
}